package com.griftt.rent.service;

import api.UserService;
import bean.User;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.griftt.rent.data.common.bean.RequestData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Component;
import service.UserRentService;

/**
 * @auther: Griftt wu
 * @date: 2019/9/16
 **/
@Service
@Component
public class UserRentServiceImpl  implements UserRentService {


    @Reference
    UserService userService;



    @Autowired
    private MongoTemplate mongoTemplate;


     @Override
    public Object getMsg(Integer id ){
        return userService.getUser(id);
    }

    @Override
    public Object insertUser(RequestData requestData) {

        User user = new User();
        user.setUid(1);
        user.setName("hello");
        user.setAddress("广州");
        System.out.println(requestData);
        return mongoTemplate.insert(user);

    }

    @Override
    public Object findUserAll() {
        return mongoTemplate.findAll(User.class);
    }
}
